package flow

import (
	"gitee.com/antflow/api/v1/flow/template:template"
	"time"
)

#State:{
	flowId: int
	namesapce: string
	name: string
	version: string
	id: int
	level: string
  task: string
  log: string
  sts: string
}
#StateRsp:{
	result: bool
}

//这是参数
#FlowInst: {
	@refer(#Flows)
	id:        int32
	context:   string
	cost:      int32
	process:   float
	state:     string
	op:        string
	OK:        bool
	err:       string
	name:      string
	namespace: string
	version:   string
}

#Flows: {
	@po()
	id:        int @pk() @auto()
	name:      string
	namespace: string
	version:   string
	input:     string
	desc:      string
	template:  string
	state:     string
	process:   float32
	cTime:     time.Time
	cost:      int
	context:   string
	error:     string
}

#InstRequest: {
	name:      string
	namespace: string
	version:   string
	input:     string
}

#InstOpRequest: {
	id:      int32
	context: string
}

#FlowInstService: {
	@srv()
	run:     template.#Template @return(#FlowInst)
	start:   #InstRequest       @return(#FlowInst)
	puase:   #InstOpRequest     @return(#FlowInst)
	recover: #InstOpRequest     @return(#FlowInst)
	stop:    #InstOpRequest     @return(#FlowInst)
	reRun:   #InstOpRequest     @return(#FlowInst)
	delete:  #InstOpRequest     @return(#FlowInst)
	patch:   #FlowInst          @return(#FlowInst)
  stats:   #State             @return(#StateRsp) @stream()
}
